home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / Kibitz / PPCBrowserOverride.a < prev    next >
Encoding:
Text File  |  1994-05-06  |  2.1 KB  |  90 lines  |  [TEXT/MPS ]

  1. *  PPCBrowser Hack to switch Macs
  2. *  This is half of a patch/filter interception that causes the PPC browser
  3. * to 'auto-change' from Zone to another if it can't find a machine in
  4. * that zone running the prgram you want (in this case, Kibitz)
  5. * NOTE!  Obviously, this is an Hack, and relies on some things not
  6. * changing (like the ID of the browser dialog)
  7.  
  8. * I'm doing way too much checking in this code, but I like it.
  9.  
  10.         case    on
  11.  
  12.     include 'traps.a'
  13.     include 'sysequ.a'
  14.  
  15.  
  16.     import (DoModalFilter):CODE
  17.     import (OurParamBlock):DATA
  18. ; Oour record structure
  19. myParamBlock RECORD 0
  20. activeFlag ds.w 1
  21. dialogUp    ds.w 1    
  22. scrollActive    ds.w 1  ; scroll active flag
  23. tickCounter    ds.l 1    ; tick count
  24. oldGND    ds.l 1  ; old GND
  25. oldMD     ds.l 1  ; old MD
  26. oldDD    ds.l 1  ; old DisposDialog
  27. oldFilter ds.l 1  ; original filter 
  28.  ENDR
  29. ppcBrowserDialogID equ -5856
  30.  
  31. ; check here to see if the dialog coming up is the PPC Browser
  32. GNDPatch proc export
  33.     with myParamBlock
  34.  lea OurParamBlock(A5),a0
  35.  
  36. ; so, the stack frame looks like this right now
  37. ;   word ID
  38. ;    long storage
  39. ;   long Behind
  40. ;   long returnAddress
  41. ; which means that we want to do this....
  42.  
  43.  cmp.w #ppcBrowserDialogID,12(SP)   ; see if the PPC browser dialog is coming up
  44.  bne.s @notPPC
  45. ; it is, set our flag
  46.  move.w #-1,dialogUp(A0)
  47. ; and move the initial tickCount into our block
  48.  move.l Ticks,D0
  49.  add.l #600,D0        ; set first increment for 10 seconds
  50.  move.l D0,tickCounter(A0)
  51. @notPPC    move.l oldGND(a0),A0    ; get old address
  52.  jmp (A0)        ; go hither
  53.  endp
  54. OurModalFilter proc export
  55.     with myParamBlock
  56.  
  57.  jsr DoModalFilter
  58.  lea OurParamBlock(A5),a0
  59.  move.l oldFilter(A0),a0
  60.  jmp (A0)
  61.  endp
  62. MDPatch proc export
  63.     with myParamBlock
  64. ; double check to see if we are really active
  65.  lea OurParamBlock(A5),a0
  66.  tst.w dialogUp(A0)
  67.  beq.s @notUp
  68.  
  69. ; replace the installed filter with our special filter
  70.  move.l 8(SP),oldFilter(A0)
  71.  
  72.  lea OurModalFilter,A1
  73.  move.l A1,8(SP)
  74. @notUp    move.l oldMD(a0),A0    ; get old address
  75.  jmp (A0)
  76.  endp
  77. DDPatch proc export
  78.     with myParamBlock
  79.  lea OurParamBlock(A5),A0
  80.  move.w #0,dialogUp(A0)
  81.     move.l oldDD(a0),A0    ; get old address
  82.  jmp (A0)
  83.     endp
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.     end